package com.cg.mapper;

import com.cg.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    //登录
   @Select("select * from users where username=#{username} and password=#{password}")
    User login(@Param("username") String username,@Param("password") String password);

   @Select("select * from users where username=#{username}")
    User findByUsername(String username);

   //添加账号
   @Insert("insert into users(username,name ,password, age, phone_number, email, created_at, updated_at)values(#{username},#{name},#{password},#{age},#{phoneNumber},#{email},now(),now()) ")
    void addUser(User user);
}
